//
//  LHTestConfigInfoVC.m
//  Loohoo
//
//  Created by 陈镇 on 2025/3/4.
//

#import "LHTestConfigInfoVC.h"
//#import "LHNetworkArgument.h"
//#import "LHStoreEnterViewController.h"
//#import "LHMyBankCardListVC.h"
//#import "LHMyWalletVC.h"
//#import "LHBusinessMainController.h"
//#import "LHMeghStockAlert.h"
#ifdef DEBUG
//#import <GDTDevToolSDK/GDTDevToolSDK.h>
#endif

@interface LHTestConfigInfoVC ()

/** <#注释#>*/
@property (nonatomic, strong) NSMutableArray * dataSource;
@end

@implementation LHTestConfigInfoVC

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.title = @"浏览配置信息";
    self.dataSource = [NSMutableArray array];
    
    self.tableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine;
    [self createData];
    [self.tableView reloadData];
    
    __weak typeof(self) weakSelf = self;
    [self createNaviBarItem:NaviBatItemTypeRigth items:@[@{@"title":@"退出",@"color":UIColorHex(222222)}] block:^(UIButton * _Nonnull btn, NSInteger index) {
        [weakSelf dismissViewControllerAnimated:YES completion:0];
    }];
}


-(void)createData{
//    
//    //当前版本
//    NSDictionary *current_version = @{@"title":@"APP版本",@"value":[NSString stringWithFormat:@"V%@(%@)",SL_SYS_CLIENTVER,LHBuild]};
//    [self.dataSource addObject:current_version];
//    //网路环境
//    LHNetWorkType type =  [LHNetworkArgument getNetworkType];
//    NSDictionary *current_environmental = @{@"title":@"服务器环境（点击切换环境）",@"value":type ==LHNetWorkTypeDevelopment ? @"测试环境":@"正式环境"};
//    [self.dataSource addObject:current_environmental];
//
//    
//    //当前用户
//    if ([LHLoginViewController isLogin]) {
//        NSString *user = [NSString stringWithFormat:@"%@ - %@ - %@",LHLoginModelObjc.mobile,LHLoginModelObjc.loohoo_user_id,LHLoginModelObjc.nickname];
//        NSDictionary *current_user = @{@"title":@"当前用户",@"value":user};
//        [self.dataSource addObject:current_user];
//    }
//    
//    NSDictionary *txAd = @{@"title":@"腾讯广告测试工具",@"value":@"点击弹出测试工具"};
//    [self.dataSource addObject:txAd];
//    
//    NSDictionary *test_1 = @{@"title":@"入驻店铺",@"value":@"入驻店铺"};
//    [self.dataSource addObject:test_1];
//    
//    NSDictionary *test_2 = @{@"title":@"我的银行卡",@"value":@"我的银行卡"};
//    [self.dataSource addObject:test_2];
// 
//    NSDictionary *test_3 = @{@"title":@"我的钱包",@"value":@"我的钱包"};
//    [self.dataSource addObject:test_3];
//    
//    NSDictionary *test_4 = @{@"title":@"工作台",@"value":@"工作台"};
//    [self.dataSource addObject:test_4];
//    
//    NSDictionary *test_5 = @{@"title":@"MEGH股份",@"value":@"MEGH股份"};
//    [self.dataSource addObject:test_5];
}


-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 60;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return self.dataSource.count;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    QMUITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"QMUITableViewCell"];
    if (!cell) {
        cell = [[QMUITableViewCell alloc] initForTableView:tableView withStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"QMUITableViewCell"];
        
        cell.textLabel.textColor = UIColorHex(444444);
        cell.detailTextLabel.textColor = UIColorHex(888888);
        cell.textLabel.font = SLFontMakeRegular(15);
        cell.detailTextLabel.font = SLFontMakeRegular(12);
        
    }

    
    
    NSDictionary *data = self.dataSource[indexPath.row];
    cell.textLabel.text = data[@"title"];
    cell.detailTextLabel.text = data[@"value"];
    
    
    
    
    
    [cell updateCellAppearanceWithIndexPath:indexPath];
    
    return cell;
    
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    
    
//    NSDictionary *data = self.dataSource[indexPath.row];
//    NSString *title = data[@"title"];
//   
//    if ([title containsString:@"服务器环境"]) {
//        
//        [[LHUserManager shareManager] saveUserInfo:nil];
//        
//        //网路环境
//        LHNetWorkType type =  [LHNetworkArgument getNetworkType];
//        
//        type = (type == LHNetWorkTypeProduct) ? LHNetWorkTypeDevelopment :LHNetWorkTypeProduct;
//        [LHNetworkArgument saveNetworkType:type];
//        exit(0);
//    }
//#ifdef DEBUG
//    if ([title containsString:@"腾讯广告测试工具"]) {
//        
//        //腾讯广告测试工具
//        UIViewController *vc =  [GDTDevToolSDK ensureEnableToolVcInDebug:YES];
//        [self.navigationController pushViewController:vc animated:YES];
//    }
//    
//#endif
//    
//    if ([title containsString:@"入驻店铺"]) {
//        
//        LHStoreEnterViewController *vc = [[LHStoreEnterViewController alloc] initWithStyle:UITableViewStyleInsetGrouped];
//        [self.navigationController pushViewController:vc animated:YES];
//    }
//    if ([title containsString:@"我的银行卡"]) {
//        
//        LHMyBankCardListVC *vc = [[LHMyBankCardListVC alloc] initWithStyle:UITableViewStyleInsetGrouped];
//        [self.navigationController pushViewController:vc animated:YES];
//    }
//    if ([title containsString:@"我的钱包"]) {
//        
//        LHMyWalletVC *vc = [[LHMyWalletVC alloc] init];
//        [self.navigationController pushViewController:vc animated:YES];
//    }
//    if ([title containsString:@"工作台"]) {
//        
//        LHBusinessMainController *vc = [[LHBusinessMainController alloc] init];
//        [self.navigationController pushViewController:vc animated:YES];
//    }
//    if ([title containsString:@"MEGH股份"]) {
//        
//        [LHMeghStockAlert showView:@{}];
//    }
    
}
@end
